package fr.univ.context.process;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class DialogActivity extends Activity {
	
	public String description;
	
	private Handler handler = new Handler();
    
	private Runnable r = new Runnable() {
		  @Override
		  public void run() {
			  finish();
		  }
    };
	
	@Override
	public void onCreate(Bundle bundle){ 
		
		super.onCreate(bundle);
		setContentView(R.layout.activity_dialog);
		
		description = null;
		
		final EditText editT = (EditText) findViewById(R.id.et_response);
	
		Button bOK = (Button) findViewById(R.id.b_ok);
		bOK.setOnClickListener( new Button.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				description = editT.getText().toString();
				finish();
			}
		});
		
		Button bCancel = (Button) findViewById(R.id.b_cancel);
		bCancel.setOnClickListener( new Button.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();				
			}
		});	
		
		handler.postDelayed(r, 40000);
	}
	
	@Override
	public void onDestroy(){
		
		super.onDestroy();
		ServiceContext.teste(description);
	}     
}